package cn.ecut.dzy.ui;


import cn.ecut.dzy.service.IAccountService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 模拟一个表现层，用于调用业务层
 */
public class Client {

    public static void main(String[] args) {
        //1.获取核心容器对象
        ClassPathXmlApplicationContext ac=new ClassPathXmlApplicationContext("bean.xml");
       // 2.根据id获取Bean对象
        IAccountService as = (IAccountService) ac.getBean("accountService");
        IAccountService as1 = (IAccountService) ac.getBean("accountService");

        System.out.println(as);
        System.out.println(as1);
        System.out.println(as==as1);
        as.saveAccount();
        //手动关闭容器
        ac.close();
    }
}
